// 用于首页和我的扫码
const ScanMixin = {
	data() {
		return {
			
		}
	},

	methods: {
		// 跳转设备详情
		toScanDetail(map) {
			if(map.area_id){//公共区域
				const url = '/packageWork/pages/area/detail?id=' + map.area_id
				uni.navigateTo({
					url: url,
				})
			}else if(map.goods_id){//设备
				const url = '/packageWork/pages/goods/detail?goods_id=' + map.goods_id
				uni.navigateTo({
					url: url,
				})
			}
		},
		// 处理扫码url中key为repair的情况（报修）
		handleRepair(map){
			if(map.room_id){
				const url = '/packageWork/pages/repair/repair?room_id=' + map.room_id
				uni.navigateTo({
					url:url
				})
			}else if(map.goods_id){
				const url = '/packageWork/pages/repair/repair?goods_id=' + map.goods_id
				uni.navigateTo({
					url:url
				})
			}else if(map.public_id){
				const url = '/packageWork/pages/repair/repair?public_id=' + map.public_id
				uni.navigateTo({
					url:url
				})
			}else if(map.area_id){
				const url = '/packageWork/pages/repair/repair?area_id=' + map.area_id
				uni.navigateTo({
					url:url
				})
			}else{
				uni.$u.toast('请扫描有效的二维码')
			}
		},
		// 处理扫码url中key为visiter的情况（访客）
		handleVisiter(map){
			if(map.id){
				const url = '/packageMe/pages/booking/visiterdetail?id=' + map.id
				uni.navigateTo({
					url:url
				})
			}else{
				uni.$u.toast('请扫描有效的二维码')
			}
		},	
		// 企业风采详情
		toEnterprise(item) {
			const url = '/pages/company/enterpriseInfo/enterpriseInfo?type=0&company_id=' + item.company_id
			uni.navigateTo({
				url: url,
			})
		},
		
	},

	
}

export default ScanMixin;
